package org.com.system.email;

import org.com.system.util.model.Action;
import org.com.system.util.utils.ModelUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

public class EmailAction extends Action<Email> {
	
	private static final long serialVersionUID = 1L;
	
	@Autowired()
	@Qualifier("emailServer")
	public EmailService server;
	
	/**
	 * 发送一封简单邮件
	 * @return
	 */
	public String sendSimpleMail(){
		server.sendSimpleMail((Email)ModelUtils.copyFromMap(getValues(), Email.class));
		return SUCCESS;
	}
	
	/**
	 * 发送一封以Html为主要内容的邮件
	 * @return
	 */
	public String sendHtmlMail(){
		server.sendSimpleMail((Email)ModelUtils.copyFromMap(getValues(), Email.class));
		return SUCCESS;
	}
	
	/**
	 * 发送一封带附件的邮件
	 * @return
	 */
	public String sendAffixMail(){
		server.sendSimpleMail((Email)ModelUtils.copyFromMap(getValues(), Email.class));
		return SUCCESS;
	}
}
